package com.mk.service.platform;

import act.controller.Controller;
import com.github.d925529.apidoc.ApiHttpMethod;
import com.github.d925529.apidoc.annotation.*;
import com.mk.domain.TMbOrderFlow;
import com.mk.interceptor.ITranslate;
import com.mk.util.S2;
import org.osgl.mvc.annotation.GetAction;
import org.osgl.mvc.annotation.PostAction;
import org.osgl.mvc.annotation.PutAction;
import org.osgl.mvc.annotation.With;

import javax.inject.Inject;
import javax.validation.constraints.NotNull;

/**
 * 说明：会员支付流水表后台服务
 * 作者：292303959@qq.com 
 * 日期：2018-10-17 10:5:57 
 * 版本：1.0.0
 */
@Controller("tMbOrderFlow")
@Api(group = "pl",title = "会员支付流水表服务", path = "/tMbOrderFlow")
@SuppressWarnings("unused")
public class TMbOrderFlowService extends BasePlatformService {
    @Inject
    private TMbOrderFlow.Mapper tMbOrderFlowMapper;


    @With({ILogin.class, ITranslate.class})
    @PostAction("add.json")
    @ApiMethod(title = "增加保存会员支付流水表", path = "/add.json", method = ApiHttpMethod.POST)
    @ApiParam(name = "tMbOrderFlow", title = "会员支付流水表", type = TMbOrderFlow.class)
    @ApiReturn(description = "主键", type = String.class)
    public String add(@NotNull TMbOrderFlow tMbOrderFlow) {
        String id = S2.UUID();
        tMbOrderFlow.setOfid(id);
        tMbOrderFlowMapper.insertTemplate(tMbOrderFlow);
        return id;
    }


    @With({ILogin.class, ITranslate.class})
    @PutAction("update.json")
    @ApiMethod(title = "修改保存会员支付流水表", path = "/update.json", method = ApiHttpMethod.PUT)
    @ApiParam(name = "tMbOrderFlow", title = "会员支付流水表", type = TMbOrderFlow.class)
    @ApiReturn(description = "修改了的数量", type = int.class)
    public int update(@NotNull TMbOrderFlow tMbOrderFlow) {
        return tMbOrderFlowMapper.updateTemplateById(tMbOrderFlow);
    }

    @With(ILogin.class)
    @GetAction("view.json")
    @ApiMethod(title = "查询指定会员支付流水表", path = "/view.json", method = ApiHttpMethod.GET)
    @ApiParam(name = "id", title = "会员支付流水表的主键", type = String.class)
    @ApiReturn(description = "会员支付流水表", type = TMbOrderFlow.class)
    public TMbOrderFlow view(@NotNull String id){
        return tMbOrderFlowMapper.single(id);
    }
}
